<template>
	<box :x="aniInfo.x" :y="aniInfo.y">
		<ani :src="aniInfo.src" @complete="rolePlayComplete" loop="true" :time="aniInfo.time" x="5" y="0"></ani>
		<img src="res/ui/bloodTop1.png" width="32" height="4" x="15" y="0"></img>
		<txt :text="info.name" x="0" y="40" size="14" color="#FFFFFF"></txt>
	</box>
</template>

<script>
init(){
	this.info= {
		id: 1,
		name: "怪物名",
		status: 0,//0站立 1行走 2无 3物理 4无 5死亡
		dir: 4,//移动方向
		body: 1,//外观,主要用于区分多个资源
		mapId: 3,//地图代码
		x: 120,//地图坐标
		y: 95,//地图坐标
		standTime: 1,//站立动画循环时间 (秒)
		walkTime: 1,//走路动画循环时间 (秒)
		runTime: 1,//跑步动画循环时间 (秒)
	};
	this.aniInfo = {
		x: 0,
		y: 0,
		time: this.info.standTime,//动画周期播放间隔 (秒)
		src: "res/ani/monster/" + this.info.body + "/monster_"+ this.info.status +"_"+ this.info.dir +".json",
	};
}

create() {
	let point = map.pointToScreen(this.info.x, this.info.y);
	this.aniInfo.x = point.x;
	this.aniInfo.y = point.y;
}

update(delta) {

}

rolePlayComplete(){
	if(this.info.status == 1 || this.info.status == 2){//人物移动动画完成恢复站立姿势
		this.info.status = 0;
		this.info.src = "res/ani/monster/" + this.info.body + "/monster_"+ this.info.status +"_"+ this.info.dir +".json";
		this.info.speed = 4;
	}
}

destroyed() {
	
}

</script>